//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Chart
{
    public class ChartFormat : IOfficeXmlSerializable
    {
        private string formatCode;

        private bool sourceLinked;

        public string FormatCode
        {
            get { return formatCode; }
            set { formatCode = value; }
        }

        public bool SourceLinked
        {
            get { return sourceLinked; }
            set { sourceLinked = value; }
        }

        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (var c = context.Read("numFmt"))
            {
                FormatCode = c.GetString("formatCode");
                SourceLinked = c.GetOptionalBoolean("sourceLinked", false);
            }
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (WriteContext c = context.Write("numFmt"))
            {
                c.SetString("formatCode", FormatCode);
                c.SetOptionalBoolean("sourceLinked", SourceLinked, false);
            }
        }

        #endregion
    }
}